package com.htt.bms.controller.system;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.htt.bms.domain.sys.SysOrg;
import com.htt.bms.service.system.SysOrgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 侯婷婷
 * @version 1.0
 * @description 组织controller
 */
@Slf4j
@Api(value = "org",tags = "组织")
@RestController
@RequestMapping("/org")
public class SysOrgController {

    @Resource
    private SysOrgService sysOrgService;

    @GetMapping("/hi")
    @ApiOperation(value = "测试能否运行")
    public String hi(){
        return "hi!";
    }

    @GetMapping("/one")
    @ApiOperation(value = "获取单个数据")
    public SysOrg selectOne(){
        return sysOrgService.getOne(Wrappers.<SysOrg>lambdaQuery().eq(SysOrg::getId, 1));
    }

    @GetMapping("/all")
    @ApiOperation("获取所有数据")
    public List<SysOrg> selectAll(){
        return sysOrgService.list();
    }
}
